from pydantic import BaseModel, Field
from typing import Optional, List
from .gen_column_schema import GenColumnCreate, GenColumnUpdate

class GenBusinessBase(BaseModel):
    app_name: str = Field(..., max_length=64, description="应用名称（英文）")
    table_name: str = Field(..., max_length=256, description="表名称（英文）")
    table_comment: Optional[str] = Field(None, max_length=256, description="表描述")
    class_name: Optional[str] = Field(None, max_length=64, description="基础类名（默认为英文表名称）")
    schema_name: Optional[str] = Field(None, max_length=64, description="Schema 名称 (默认为英文表名称)")
    filename: Optional[str] = Field(None, max_length=64, description="基础文件名（默认为英文表名称）")
    default_datetime_column: bool = Field(True, description="是否存在默认时间列")
    api_version: str = Field("v1", max_length=32, description="代码生成 api 版本，默认为 v1")
    gen_path: Optional[str] = Field(None, max_length=256, description="代码生成路径（默认为 app 根路径）")
    remark: Optional[str] = Field(None, description="备注")


class GenBusinessCreate(GenBusinessBase):
    pass


class GenBusinessUpdate(GenBusinessBase):
    pass


class GenBusinessQuery(BaseModel):
    table_name: Optional[str] = Field(None, description="表名")
    table_comment: Optional[str] = Field(None, description="表描述")
    start_time: Optional[str] = Field(None, description="开始时间")
    end_time: Optional[str] = Field(None, description="结束时间")